﻿<%@ Page Language="C#"  Title="养护方案统计"  MasterPageFile="~/W_View/PageMaster.Master"  CodeBehind="DF_SeclassprojPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.Fondos.DF_SeclassprojPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Jquery/ajaxfileupload.js")%>

    <script type="text/javascript">
        //function SetInsert() {
        //    var road = $('#cmbRoads').combobox("getValue");
        //    if (!road) {
        //        $.messager.alert('消息提示', '请选择资金模型！', 'warning');
        //        return;
        //    }

        //    $.ajax({
        //        url: "/api/dfseclassproj/seetbcr?rdwayid=" + road + "",
        //        type: "GET",
        //        success: function () {
        //            $.messager.alert('成功', '同步成功!', "info");
        //            $('#dg').datagrid({ url: '/api/costbenefit', pageNumber: 1 });
        //        },
        //        error: function (err) {
        //            $.messager.alert('错误提示', '同步失败 -' + err, "error");
        //        }
        //    });
        //}

        //同步数据
        function SetInsert() {
            var road = $('#cmbRoads').combobox("getText");
            if (!road) {
                $.messager.alert('消息提示', '请选择资金模型！', 'warning');
                return;
            }


            $.messager.progress({
                title: '请等待',
                msg: '加载数据中...'
            });

            $.ajax({
                url: "/api/dfseclassproj/SetInsert?anniname=" + road + "",
                type: "GET",
                success: function () {
                    $.messager.progress('close');
                    $.messager.alert('成功', '同步成功!', "info");
                    $('#cmbRoads').combobox("setValue", road);
                    $('#dg').datagrid({ url: '/api/dfseclassproj?road=' + road + '', pageNumber: 1 });
                },
                error: function (err) {
                    $.messager.progress('close');
                    $.messager.alert('错误提示', '同步失败 -' + err, "error");
                }
            });
        }



        function search(n, o) {
            var road = $('#cmbRoads').combobox("getValue");

            var url = '/api/dfseclassproj';
            var urlParam = "";
            if (road != "" && road != "0") urlParam += "road=" + encodeURI(road) + "&";
            if (urlParam != "") {
                urlParam = "?" + urlParam.substring(0, urlParam.length - 1);
                url = url + urlParam;
            }

            $('#dg').datagrid({ url: url, pageNumber: 1 });
        }


        $(function () {
            var number = '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            loadAdmDiv();
            dataGridBind($('#dg'), '/api/dfseclassproj', '养护方案统计', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });
        })

    </script>    

    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  >
        <thead>
            <th data-options="field:'Id',editor:'text',width:80,align:'right',hidden:true">ID</th>
            <th data-options="field:'Anni_Name',editor:'text',width:80,align:'right' " >资金模型名称</th>
            <th data-options="field:'Roadnet_Name',editor:'text',width:100,align:'right' " >路网名称</th>
            <th data-options="field:'Analy_Year',editor:'text',width:100,align:'right' " >分析年度</th>
            <%--<th data-options="field:'Pvmttype',editor:'text',width:100,align:'right' " >路面类型</th>--%>
            <th data-options="field:'Rd_Class',editor:'text',width:100,align:'right' " formatter="formatRoadClass">分路等级</th>
            <th data-options="field:'Dailymain_Cost',editor:'text',width:120,align:'right' " >日常养护费用/万元</th>
            <th data-options="field:'Dailymain_Leg',editor:'text',width:120,align:'right' " >日常养护里程/KM</th>

            <th data-options="field:'Premain_Cost',editor:'text',width:120,align:'right' " >预防性养护费用/万元</th>
            <th data-options="field:'Premain_Leg',editor:'text',width:120,align:'right' " >预防性养护里程/KM</th>

            <th data-options="field:'Medmian_Cost',editor:'text',width:120,align:'right' " >中修费用/万元</th>
            <th data-options="field:'Medmian_Leg',editor:'text',width:120,align:'right' " >中修里程/KM</th>

            <th data-options="field:'Majmain_Cost',editor:'text',width:120,align:'right' " >大修费用/万元</th>
            <th data-options="field:'Majmain_Leg',editor:'text',width:120,align:'right' " >大修里程/KM</th>

        </thead>
    </table>
   
    <div id="tb">
       
         <select id="cmbRoads" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'资金模型名称',url:'/api/dfcostmodpara/anniname',method:'get',valueField:'id',textField:'id',onChange:search">
         </select>
         <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="SetInsert()">同步数据</a>
    </div>
</asp:Content>